package com.ytc.restcontroller;

import com.ytc.mapper.LetterMapper;
import com.ytc.model.Letter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class LetterServiceImpl {
    @Autowired
    private LetterMapper letterMapper;

    //柴晓颖：站内短信查询
    @RequestMapping("queryUnreadLetter")
    public List<Letter> queryUnreadLetter(@RequestParam("uId") Integer uId){
        return letterMapper.queryUnreadLetter(uId);
    }

    //柴晓颖：修改站内短信阅读状态（已读）
    @RequestMapping("updateLstatusRead")
    public void updateLstatusRead(@RequestParam("lId") Integer lId){
        letterMapper.updateLstatusRead(lId);
    }

    //柴晓颖：站内已读短信查询
    @RequestMapping("queryReadLetter")
    public List<Letter> queryReadLetter(@RequestParam("uId") Integer uId){
        return letterMapper.queryReadLetter(uId);
    }

    //柴晓颖：作者发送站内短信
    @RequestMapping("authorSendLetter")
    public void authorSendLetter(@RequestBody Letter letter){
        letterMapper.authorSendLetter(letter);
    }
}
